package com.hzsun.redis.controller;

import com.hzsun.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: DingJl
 * @Date: 2022/1/26 11:07
 * @Version 1.0
 */
@RestController
public class RedisController {

    @Autowired
    private  RedisService redisService;

    @RequestMapping("/set")
    public  String set(@RequestParam String key,@RequestParam  String value){
        redisService.set(key,value);
        return  "success";
    }

    @RequestMapping("/get")
    public  String get(@RequestParam String key){
        Object o = redisService.get(key);
        return  String.valueOf(o);
    }


}
